package com.gitee.wsl.collections.iterator.api

/**
 * Defines an iterator that operates over an ordered container. Subset of [java.util.ListIterator].
 *
 *
 * This iterator allows both forward and reverse iteration through the container.
 *
 *
 * @param <E> the type of elements returned by this iterator.
 * @since 3.0
</E> */
interface OrderedIterator<E> : Iterator<E> {
    /**
     * Checks to see if there is a previous element that can be iterated to.
     *
     * @return `true` if the iterator has a previous element
     */
    fun hasPrevious(): Boolean

    /**
     * Gets the previous element from the container.
     *
     * @return the previous element in the iteration
     * @throws NoSuchElementException if the iteration is finished
     */
    fun previous(): E
}